/*
 * Copyright (c) Extreme Vision Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef EV_DEPLOY_H
#define EV_DEPLOY_H
#include <string>
#include "evdeploy/core/ev_common_data.h"

namespace ev

{

    class EVDeploy
    {
    private:
        EVDeploy();

        EVDeploy(const EVDeploy &) = delete;

        EVDeploy &operator=(const EVDeploy &) = delete;

    public:
        static EVDeploy &GetModel();

        /**
         * @brief init model info
         * @param[in] config_file: config file name for model info
         * @return true if config file is right, else false
         */
        bool InitModel(const std::string &config_file);
        /**
         * @brief create one model
         * @param[in] uuid: create one model specified by the model uuid, complete model init will be done
         * @return false if some error occurs, e.g., the model file not exist, the runtime not supported.
         */
        bool CreateModel(const std::string &uuid);
        /**
         * @brief run inference
         * @param[in] uuid: uuid for specified model
         * @param[in] inputs: input image data wrapped with EVModelData format
         * @param[out] outputs: inference output wrapped with EVModelData format
         * @return false if some error occurs
         */
        bool RunInfer(const std::string &uuid, EVModelData *inputs, EVModelData *outputs);
        /**
         * @brief release resource
         * @param[in] uuid: uuid for specified model, the resource will be realeased
         * @return false if some error occurs
         */
        bool DestroyModel(const std::string &uuid);
        /**
         * @brief get version info
         * @param[out] version: EVDeploy version info
         * @return false if some error occurs
         */
        bool GetVersion(std::string &version);
    };

} // end namespace ev
#endif
